netfilter: nf_tables: disallow element removal on anonymous sets
authorSasha Levin <sashal@kernel.org>
Sun, 10 Sep 2023 17:04:45 +0000 (19:04 +0200)
committerSalvatore Bonaccorso <carnil@debian.org>
Fri, 29 Sep 2023 04:25:15 +0000 (05:25 +0100)
commit50719e8d1e4eb78cf12f8922247a880623b893b4
treeb8ee05bd4d86061ea503131662ac51bddee8579a
parentc3f854ee8717d0c3ec08dcd63a410bc44ac0b977
netfilter: nf_tables: disallow element removal on anonymous sets

[ Upstream commit 23a3bfd4ba7acd36abf52b78605f61b21bdac216 ]

Anonymous sets need to be populated once at creation and then they are
bound to rule since 938154b93be8 ("netfilter: nf_tables: reject unbound
anonymous set before commit phase"), otherwise transaction reports
EINVAL.

Userspace does not need to delete elements of anonymous sets that are
not yet bound, reject this with EOPNOTSUPP.

From flush command path, skip anonymous sets, they are expected to be
bound already. Otherwise, EINVAL is hit at the end of this transaction
for unbound sets.

Fixes: 96518518cc41 ("netfilter: add nftables")
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Gbp-Pq: Topic bugfix/all
Gbp-Pq: Name netfilter-nf_tables-disallow-element-removal-on-anon.patch
net/netfilter/nf_tables_api.c